angular.module('starter', ['ngCordova','ionic','ionic-datepicker','ionic-citypicker','starter.blackController','starter.zjrController',
'starter.creditController','starter.myController','starter.commonController','starter.commonService','starter.blackService',
'starter.zjrService', 'starter.creditService', 'starter.myService'])

.run(function($ionicPlatform,$state,$cordovaKeyboard,$ionicHistory,$window,$cordovaAppVersion,CommonService,$cordovaDevice,$ionicPopup,$cordovaFileTransfer,$cordovaFileOpener2,$timeout,$ionicLoading,$cordovaContacts) {
  
  $ionicPlatform.ready(function() {
  	
		var uuid = null;
		try{
				uuid=$cordovaDevice.getUUID();
		}catch(e){
			
		}
		
		if(uuid==null||uuid==''){
			$window.location.href='http://app.credit-manage.com/down/index.html';
		}
	    		
    if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      cordova.plugins.Keyboard.disableScroll(true);

    }
    if (window.StatusBar) {
      StatusBar.styleDefault();
    }
    
    //检测更新
    //checkUpdate();
    
    //清空页面缓存
    $ionicHistory.clearCache();
		$ionicHistory.clearHistory();
    
    //初始化极光推送
	  try {
	    	window.plugins.jPushPlugin.init(); 
	  } catch (exception) {

	  }
	  
	  //关闭启动页面
	  try{
	  		navigator.splashscreen.hide();
	  }catch(e){
	  	
	  }

    
    //收到消息处理
    try{
	    	window.plugins.jPushPlugin.openNotificationInAndroidCallback = function (data)
				{
					plugins.jPushPlugin.setBadge(badge);
				  $state.go('tab.my');
				}
				
				window.plugins.jPushPlugin.receiveNotificationIniOSCallback = function(data){
					plugins.jPushPlugin.setBadge(badge);
					$state.go('tab.my');
				}

				//平台判断
                if(window.plugins.jPushPlugin.isPlatformIOS){

                	//前台收到通知
                	document.addEventListener("jpush.receiveNotification",function(event){
                       
                	}); 

                	//后台收到通知
                	document.addEventListener("jpush.backgroundNotification", function(event){
	          
	                	

	                });

	                document.addEventListener("pause",function(){
	                	window.plugins.jPushPlugin.setApplicationIconBadgeNumber(0);
	                });

	                document.addEventListener("resume",function(){
	                	window.plugins.jPushPlugin.setApplicationIconBadgeNumber(0);
	                });


                }


    } catch(exception){
    	
    }
	  
	  var userId=null;
    var token=null;
    try{
    	userId=JSON.parse($window.localStorage["user"] || '{}').userId;
    	token=JSON.parse($window.localStorage["user"] || '{}').token;
    }catch(e){}
		
		var options = {};
	  options.filter = "";
	  options.multiple = true;

	  //检查更新方法
	  function checkUpdate(){
			    var type=0;
					if(ionic.Platform.isIOS()){
							type=2;
					}else if(ionic.Platform.isAndroid()){
							type=1;
					}
		
			    //获取版本
			    $cordovaAppVersion.getVersionNumber().then(function (version) {
					    
			    		CommonService.getAppInfo(type).then(function (response) {
								if(version<response.data.versionNo){
										var confirmPopup = $ionicPopup.show({
								        title: '版本升级-'+response.data.versionNo,
								        template: response.data.content,
								        buttons: [
													{
														text: '<b>升级</b>',
														type: 'button-positive',
														onTap:function(e){
																$window.open('http://www.credit-manage.com','_system','location=yes');
																e.preventDefault();
														}
													}
												],
								        cssClass:'my-custom-popup'
								   	});
								   	
								   	confirmPopup.then(function(res) {
								   			ionic.Platform.exitApp();
									  });
								}
							});
			    		
			    });
		  }

  });
  
  
})
	
	//配置文件设置
.config(function($stateProvider, $urlRouterProvider,$ionicConfigProvider,ionicDatePickerProvider,$httpProvider) {
	var weekDaysList = ["日", "一", "二", "三", "四", "五", "六"];
 	var monthList = ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"];

	var datePickerObj = {
      inputDate: new Date(),
      setLabel: '确定',
      todayLabel: '今天',
      closeLabel: '关闭',
      mondayFirst: false,
      weeksList: weekDaysList,
      monthsList: monthList,
      templateType: 'popup',
      showTodayButton: true,
      dateFormat: 'yyyy-MM-dd',
      closeOnSelect: false
	};
	ionicDatePickerProvider.configDatePicker(datePickerObj);
	
	$ionicConfigProvider.platform.ios.tabs.style('ios'); 
	$ionicConfigProvider.platform.ios.tabs.position('bottom');
	$ionicConfigProvider.platform.android.tabs.style('ios');
	$ionicConfigProvider.platform.android.tabs.position('bottom');
	
	$ionicConfigProvider.platform.ios.navBar.alignTitle('center'); 
	$ionicConfigProvider.platform.android.navBar.alignTitle('center');
	$ionicConfigProvider.backButton.text('返回').icon('ion-ios-arrow-left');        
	
	$ionicConfigProvider.platform.ios.views.transition('ios'); 
	$ionicConfigProvider.platform.android.views.transition('ios');
	
	$ionicConfigProvider.views.transition('no');
	
	$ionicConfigProvider.views.swipeBackEnabled(false);
	
	//拦截器配置
	$httpProvider.interceptors.push(function ($q, $location, $rootScope,$window) {
	    return {
	        'request': function (config) {
	        	
	        		if(config.method == "POST"){
		        			var userId=null;
			            var token=null;
			            //版本号
			            var version='4.0.1';
			            try{
			            	userId=JSON.parse($window.localStorage["user"] || '{}').userId;
			            	token=JSON.parse($window.localStorage["user"] || '{}').token;
			            }catch(e){}
									
									if(userId!=null&&token!=null){
										if(!config.params){
											config.params=new Object();
										}
										config.params['userId']=userId;
										config.params['token']=token;
										//版本号
										config.params['version']=version;
									}
	        		}

	            return config;
	        },
	        'response':function(response){
	        		if (response.config.method == "POST") {
		        		 	if(response.data.success=='nologin'){
		        		 		console.log("nologin:");
		        		 		console.log(response);
		        		 			$location.path('/login');
						          return $q.reject(response);
		        		 	}
					    }
					    return response;
	        }
	    };
	});

	
	//初始化状态
  $stateProvider

	//主页面
  .state('tab', {
    url: '/tab',
    abstract: true,
    cache: false,
    templateUrl: 'templates/tabs.html'
  })
  
  //自金融
	.state('tab.zjr', {
      url: '/zjr',
      cache: true,
      views: {
        'tab-zjr': {
          controller: 'ZjrCtrl',
        	templateUrl: 'templates/zjr/tab-zjr.html'
        }
      }
 })
  
  //短贷产品明细
	.state('tab.produceDuanDetail', {
	  url: '/zjr/produceDuan/:produceId',
	  cache: false,
	  views: {
	    'tab-zjr': {
	      templateUrl: 'templates/zjr/produceDuanDetail.html',
	      controller:'ProduceDetailDuanController'
	    }
	  }
	})
	
	//长贷产品明细
	.state('tab.produceChangDetail', {
	  url: '/zjr/produceChang/:produceId',
	  cache: false,
	  views: {
	    'tab-zjr': {
	      templateUrl: 'templates/zjr/produceChangDetail.html',
	      controller:'ProduceDetailChangController'
	    }
	  }
	})
	
	//发布短贷产品
	.state('tab.addProduce', {
	  	url: '/addProduce',
      cache: false,
      views: {
	    	'tab-addProduce': {
	      templateUrl: 'templates/zjr/addProduce.html',
	      controller:'AddProduceController'
	    }
	  }
	})
	
	//发布新手贷产品
	.state('tab.addXsb', {
	  url: '/addXsb',
	  cache: false,
	  views: {
	    'tab-addProduce': {
	      templateUrl: 'templates/zjr/addXsb.html',
	      controller:'AddXsbController'
	    }
	  }
	})
	
	//催收记录
	.state('tab.loanCollection', {
	  url: '/my/loanCollection',
	  params:{"type":null,"produceId":null},
	  cache: false,
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/my/loanCollection.html',
	      controller: 'LoanCollectionController'
	    }
	  }
	})
	
	//投借学院
	.state('tab.articles', {
	  url: '/zjr/articles',
	  cache: false,
	  views: {
	    'tab-zjr': {
	      templateUrl: 'templates/zjr/articles.html',
	      controller:'ArticleController'
	    }
	  }
	})
	
	//投借学院正文
	.state('tab.article', {
	  url: '/zjr/articles/article',
	  cache: false,
	 	params:{"articleId":null,"title":null,"time":null},
	  views: {
	    'tab-zjr': {
	      templateUrl: 'templates/zjr/articleDetail.html',
	      controller:'ArticleDetailController'
	    }
	  }
	})
	
	//信息提示
	.state('tab.help', {
	  url: '/zjr/help',
	  cache: false,
	  views: {
	    'tab-zjr': {
	      templateUrl: 'templates/zjr/help.html'
	    }
	  }
	})

	//帮助明细
	.state('tab.helpDetail', {
	  url: '/zjr/help/helpDetail?state',
	  cache: false,
	  views: {
	    'tab-zjr': {
	      templateUrl: 'templates/zjr/helpDetail.html',
	      controller:'HelpDetailController'
	    }
	  }
	})
	
	//等级提升规则
	.state('tab.levelRule', {
	  url: '/zjr/help/levelRule',
	  cache: false,
	  views: {
	    'tab-zjr': {
	      templateUrl: 'templates/zjr/levelRule.html',
	    }
	  }
	})
	
	//增减规则
	.state('tab.addRule', {
	  url: '/zjr/help/addRule',
	  cache: false,
	  views: {
	    'tab-zjr': {
	      templateUrl: 'templates/zjr/addRule.html',
	    }
	  }
	})
	
	.state('tab.accountDetail', {
	  url: '/user/accountDetail',
	  cache: false,
	  views: {
	    'tab-user': {
	      templateUrl: 'templates/zjr/tab-accountDetail.html',
	      controller:'AccountDetailController'
	    }
	  }
	})
	
	.state('tab.userInfo', {
	  url: '/userInfo?searchUserId',
	  cache: false,
	  views: {
	    'tab-user': {
	      templateUrl: 'templates/zjr/userDetail2.html',
	      controller:'UserInfoController'
	    }
	  }
	})
	
	.state('tab.myProduceList', {
	  url: '/myProduceList?uid',
	  cache: false,
	  views: {
	    'tab-produces': {
	      templateUrl: 'templates/zjr/myProduceList.html',
	      controller:'MyProduceController'
	    }
	  }
	})
	
		.state('tab.myProduceList2', {
	  url: '/myProduceList2?uid',
	  cache: false,
	  views: {
	    'tab-user': {
	      templateUrl: 'templates/zjr/myProduceList.html',
	      controller:'MyProduceController'
	    }
	  }
	})
	
	 //高级认证
	.state('confirm', {
	  url: '/confirm',
	  cache: false,
	  params:{"type":null},
	  templateUrl: 'templates/zjr/confirm.html',
	  controller:'ConfirmController'
	})
	
		.state('tab.loanRedList', {
	  url: '/user/loanRedList',
	  cache: false,
	  views: {
	    'tab-user': {
	      templateUrl: 'templates/zjr/loanRedList.html',
	      controller:'LoanRedListController'
	    }
	  }
	})

	//黑名单主页面
	.state('tab.black', {
      url: '/black',
      cache: false,
      views: {
        'tab-black': {
        	controller:'NetworkCollectRecordController',
        	templateUrl: 'templates/black/tab-black.html'
        }
      }
 	})
	
	//网友曝光明细
	.state('tab.networkCollectDetail', {
	  url: '/black/networkCollectDetail/:networkCollectRecordId',
	  cache: false,
	  views: {
	    'tab-black': {
	      controller:'networkCollectRecordDetailController',
	      templateUrl: 'templates/black/networkCollectRecordDetail.html'
	    }
	  }
	})
	
	//权威发布明细
	.state('tab.breakRecordDetail', {
	  url: '/black/breakRecordDetail/:breakRecordId',
	  cache: false,
	  views: {
	    'tab-black': {
	      controller:'breakRecordDetailController',
	      templateUrl: 'templates/black/breakRecordDetail.html'
	    }
	  }
	})

	//违约申述
	.state('tab.allegemanaCommit', {
	  url: '/black/allegemanaCommit/:breakRecordId/:type',
	  cache: false,
	  views: {
	    'tab-black': {
	      controller:'allegemanaCommitController',
	      templateUrl: 'templates/black/allegemanaCommit.html'
	    }
	  }
	})
	//违约发布
	.state('tab.networkPublish', {
	  url: '/black/networkPublish/:breakRecordId/:type',
	  cache: false,
	  views: {
	    'tab-black': {
	      controller:'networkPublishController',
	      templateUrl: 'templates/black/networkPublish.html'
	    }
	  }
	})
	
	
	//信用管理
	.state('tab.credit', {
      url: '/credit',
      cache: false,
      views: {
        'tab-credit': {
        	controller:'CreditCtrl',
        	templateUrl: 'templates/credit/tab-credit.html'
        }
      }
 	})
	
	//必填类
	.state('tab.generalInfo', {
      url: '/credit/generalInfo',
      cache: false,
      views: {
        'tab-credit': {
        	controller:'GeneralInfoCtrl',
        	templateUrl: 'templates/credit/generalInfo.html'
        }
      }
 	})
	
	//等级特权（信用管理）
	.state('tab.rankPrivilege', {
	  url: '/rankPrivilege',
	  cache: false,
	  views: {
	    'tab-credit': {
	      templateUrl: 'templates/credit/rankPrivilege.html'
	    }
	  }
	})
		//等级提升规则（信用管理）
	.state('tab.levelCreditRule', {
	  url: '/credit/levelCreditRule',
	  cache: false,
	  views: {
	    'tab-credit': {
	      templateUrl: 'templates/zjr/levelRule.html',
	    }
	  }
	})
		//信用身价增减规则（信用管理）
	.state('tab.addCreditRule', {
	  url: '/credit/addCreditRule',
	  cache: false,
	  views: {
	    'tab-credit': {
	      templateUrl: 'templates/zjr/addRule.html',
	    }
	  }
	})
	
	//发表界面必填类
	.state('tab.authGeneralInfo', {
      url: '/authGeneralInfo',
      cache: false,
      views: {
        'tab-addProduce': {
        	controller:'GeneralInfoCtrl',
        	templateUrl: 'templates/credit/generalInfo.html'
        }
      }
 	})
	
	//高级认证
	.state('tab.authenTication', {
      url: '/credit/authenTication',
      cache: false,
      views: {
        'tab-credit': {
        	controller:'AuthenTicationCtrl',
        	templateUrl: 'templates/credit/authenTication.html'
        }
      }
 	})
	
	//信用明细
	.state('tab.creditDetail', {
      url: '/credit/creditDetail',
      cache: false,
      views: {
        'tab-credit': {
        	controller:'CreditDetailCtrl',
        	templateUrl: 'templates/credit/creditDetail.html'
        }
      }
 	})
	
	//信用明细
	.state('tab.income', {
      url: '/credit/income',
      cache: false,
      views: {
        'tab-credit': {
        	controller:'IncomeCtrl',
        	templateUrl: 'templates/credit/income.html'
        }
      }
 	})
	//运营商认证
	.state('tab.mno', {
      url: '/credit/mno/:back',
      cache: false,
      views: {
        'tab-credit': {
        	controller:'MnoCtrl',
        	templateUrl: 'templates/credit/mno.html'
        }
      }
 	})	
	//信用管理帮助信息
	.state('tab.creditHelp', {
	  url: '/credit/creditHelp',
	  cache: false,
	  views: {
	    'tab-credit': {
	    	controller:'creditHelpCtrl',
	      templateUrl: 'templates/credit/creditHelp.html'
	    }
	  }
	})
 	
 	//我的
	.state('tab.my', {
      url: '/my',
      cache: false,
      views: {
        'tab-my': {
        	controller:'MyCtrl',
        	templateUrl: 'templates/my/tab-my.html'
        }
      }
 	})
	
	//编辑资料
	.state('tab.editInfo', {
      url: '/editInfo',
      cache: false,
      views: {
        'tab-my': {
        	controller:'EditInfoCtrl',
        	templateUrl: 'templates/my/editInfo.html'
        }
      }
 	})
	
	//编辑昵称界面
	.state('tab.editNick', {
      url: '/my/editNick',
      cache: false,
      views: {
        'tab-my': {
        	controller:'EditNickCtrl',
        	templateUrl: 'templates/my/editNick.html'
        }
      }
 	})
	
	//支付宝充值
	.state('tab.zhiFuBao', {
      url: '/my/zhiFuBao',
      cache: false,
      views: {
        'tab-my': {
        	controller:'ZhiFuBaoCtrl',
        	templateUrl: 'templates/my/zhiFuBao.html'
        }
      }
 	})
	
	//编辑实名绑卡界面
	.state('tab.bandCard', {
      url: '/my/bandCard',
      cache: false,
      views: {
        'tab-my': {
        	controller:'BandCardCtrl',
        	templateUrl: 'templates/my/bandCard.html'
        }
      }
 	})
	
	//编辑实名绑卡界面
	.state('tab.editPhone', {
      url: '/my/editPhone',
      cache: false,
      views: {
        'tab-my': {
        	controller:'UpdatePhoneCtrl',
        	templateUrl: 'templates/my/editPhone.html'
        }
      }
 	})
	
	//编辑密码界面
	.state('tab.editPassword', {
      url: '/my/editPassword',
      cache: false,
      views: {
        'tab-my': {
        	controller:'UpdatePasswordCtrl',
        	templateUrl: 'templates/my/editPassword.html'
        }
      }
 	})
	
	//编辑交易密码界面
	.state('tab.editDealCode', {
      url: '/my/editDealCode',
      cache: false,
      views: {
        'tab-my': {
        	controller:'DealCodeCtrl',
        	templateUrl: 'templates/my/editDealCode.html'
        }
      }
 	})
	
	//编辑卡片界面
	.state('tab.editCard', {
      url: '/my/editCard',
      cache: false,
      views: {
        'tab-my': {
        	controller:'EditCardCtrl',
        	templateUrl: 'templates/my/editCard.html'
        }
      }
 	})
	
	//资金明细
	.state('tab.capitalDetail', {
      url: '/my/capitalDetail',
      cache: false,
      views: {
        'tab-my': {
        	controller:'CapitalDetailCtrl',
        	templateUrl: 'templates/my/capitalDetail.html'
        }
      }
 	})
	
		//关注列表
	.state('tab.gzList', {
	  url: '/my/gzList',
	  cache: false,
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/my/gzList.html',
	      controller:'GzController'
	    }
	  }
	})
	
	//粉丝列表
	.state('tab.fsList', {
	  url: '/my/fsList',
	  cache: false,
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/my/fsList.html',
	      controller:'FsController'
	    }
	  }
	})
	
	//借入-短贷
	.state('tab.borrowDuan', {
	  url: '/my/borrowDuan',
	  cache: false,
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/my/borrowDuan.html',
	      controller:'BorrowDuanController'
	    }
	  }
	})
	
	//短贷还款
	.state('tab.payBackDuan', {
	  url: '/my/produceDuan/:produceId',
	  cache: false,
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/my/payBackDuan.html',
	      controller:'PayBackDuanController'
	    }
	  }
	})
	
	//借入-长贷
	.state('tab.borrowChang', {
	  url: '/my/borrowChang',
	  cache: false,
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/my/borrowChang.html',
	      controller:'BorrowChangController'
	    }
	  }
	})
	
	//借出-短贷
	.state('tab.loanDuan', {
	  url: '/my/loanDuan',
	  cache: false,
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/my/loanDuan.html',
	      controller:'LoanDuanController'
	    }
	  }
	})
	
	//借出-长贷
	.state('tab.loanChang', {
	  url: '/my/loanChang',
	  cache: false,
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/my/loanChang.html',
	      controller:'LoanChangController'
	    }
	  }
	})
	
	//历史账单
	.state('tab.oldAccountDetail', {
	  url: '/my/oldAccountDetail',
	  cache: false,
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/my/oldAccountDetail.html',
	      controller:'OldAccountDetailCtrl'
	    }
	  }
	})
	
	//查询还款明细
	.state('tab.payBackDetails', {
	  url: '/my/payBackDetails',
	  cache: false,
	  params:{"longProduceId":null,"longLoanRecordId":null},
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/my/payBackDetails.html',
	      controller:'PayBackDetailsController'
	    }
	  }
	})
	
	//分期还款列表-借入
	.state('tab.instalmentList', {
	  url: '/my/instalmentList/:longProduceId/:payBackStatus',
	  cache: false,
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/my/instalmentList.html',
	      controller:'InstalmentListController'
	    }
	  }
	})
	
	//分期还款列表-借出
	.state('tab.instalmentListLoan', {
	  url: '/my/instalmentListLoan/:longLoanRecordId/:payBackStatus',
	  cache: false,
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/my/instalmentListLoan.html',
	      controller:'InstalmentListLoanController'
	    }
	  }
	})
	
	//长贷，我不借了明细界面
	.state('tab.payBackChang', {
	  url: '/my/payBackChang/:longProduceId/:status',
	  cache: false,
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/my/payBackChang.html',
	      controller:'PayBackChangController'
	    }
	  }
	})
	
	//长贷提前还款
	.state('tab.payBackChangT', {
	  url: '/my/payBackChangT',
	  cache: false,
	  params:{"longProduceId":null},
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/my/payBackChangT.html',
	      controller:'PayBackChangTController'
	    }
	  }
	})
	
	//长贷当期还款
	.state('tab.payBackChangD', {
	  url: '/my/payBackChangD',
	  cache: false,
	  params:{"account":null,"longProducePayBackId":null,"longProduceId":null,"breakMoney":null},
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/my/payBackChangD.html',
	      controller:'PayBackChangDController'
	    }
	  }
	})
	
	//提现
	.state('tab.withDraw', {
      url: '/my/withDraw',
      cache: false,
      views: {
        'tab-my': {
        	controller:'WithDrawCtrl',
        	templateUrl: 'templates/my/withDraw.html'
        }
      }
 	})
	
	//投资券
	.state('tab.investment', {
      url: '/my/investment',
      cache: false,
      views: {
        'tab-my': {
        	controller:'InvestmentCtrl',
        	templateUrl: 'templates/my/investment.html'
        }
      }
 	})
	
	//邀请码
	.state('tab.inviteCode', {
      url: '/my/inviteCode',
      cache: false,
      views: {
        'tab-my': {
        	controller:'InviteCodeCtrl',
        	templateUrl: 'templates/my/inviteCode.html'
        }
      }
 	})
	
	//邀请码收益列表
	.state('tab.inviteList', {
      url: '/my/inviteList',
      cache: false,
      views: {
        'tab-my': {
        	controller:'InviteListCtrl',
        	templateUrl: 'templates/my/inviteList.html'
        }
      }
 	})
	//邀请码收益列表(二级受邀人)
	.state('tab.myInviteList', {
      url: '/my/myInviteList/:customerId',
      cache: false,
      views: {
        'tab-my': {
        	controller:'myInviteList',
        	templateUrl: 'templates/my/myInviteList.html'
        }
      }
 })
	
	//邀请码帮助页面
	.state('tab.helpInvite', {
      url: '/my/helpInvite',
      cache: false,
      views: {
        'tab-my': {
        		controller:'HelpController',
        	templateUrl: 'templates/my/helpDetail.html'
        }
      }
 	})
	
	//消息中心
	.state('tab.msg', {
      url: '/my/msg',
      cache: false,
      views: {
        'tab-my': {
        	controller:'MsgController',
        	templateUrl: 'templates/my/msgList.html'
        }
      }
 	})

	//公共调用
	
	//征信页面(自金融调用)
	.state('tab.zjrCreditCheck', {
	  url: '/zjrCreditCheck/:customerId',
	  cache: false,
	  views: {
	    'tab-zjr': {
	      templateUrl: 'templates/common/creditCheck.html',
	      controller:'CreditCheckCtrl'
	    }
	  }
	})
	
	//征信页面(信用管理调用)
	.state('tab.creditCheck', {
	  url: '/creditCheck/:customerId',
	  cache: false,
	  views: {
	    'tab-credit': {
	      templateUrl: 'templates/common/creditCheckCredit.html',
	      controller:'CreditCheckCtrl'
	    }
	  }
	})
	
		//征信页面(我的调用)
	.state('tab.myCreditCheck', {
	  url: '/myCreditCheck/:customerId/:type',
	  cache: false,
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/common/creditCheck.html',
	      controller:'CreditCheckCtrl'
	    }
	  }
	})
	
		//短贷笔数-我的点击进去
	.state('tab.myLoanDuanDetail', {
	  url: '/myLoanDuanDetail/:customerId',
	  cache: true,
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/common/loanList.html',
	      controller:'LoanDuanDetailCtrl'
	    }
	  }
	})
	
	//长贷笔数-我的点击进去
	.state('tab.myLoanChangDetail', {
	  url: '/myLoanChangDetail/:customerId',
	  cache: true,
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/common/changList.html',
	      controller:'LoanChangDetailCtrl'
	    }
	  }
	})
	

	
	//短贷笔数-首页点击进去
	.state('tab.loanDuanDetail', {
	  url: '/loanDuanDetail/:customerId',
	  cache: true,
	  views: {
	    'tab-zjr': {
	      templateUrl: 'templates/common/loanList.html',
	      controller:'LoanDuanDetailCtrl'
	    }
	  }
	})
	
	//长贷笔数-首页点击进去
	.state('tab.loanChangDetail', {
	  url: '/loanChangDetail/:customerId',
	  cache: true,
	  views: {
	    'tab-zjr': {
	      templateUrl: 'templates/common/changList.html',
	      controller:'LoanChangDetailCtrl'
	    }
	  }
	})
		
	//出借人协议（主页）
	.state('tab.zjrcjrxy', {
	  url: '/zjrcjrxy',
	  cache: false,
	  views: {
	    	'tab-zjr': {
		    	templateUrl: 'templates/zjr/zjrcjrxy.html'
		    }
	  }
	})
	//借贷人协议（主页）
	.state('tab.zjrjdxy', {
	  url: '/zjrjdxy',
	  cache: false,
	  views: {
	    	'tab-zjr': {
		    	templateUrl: 'templates/zjr/zjrjdxy.html'
		    }
	  }
	})
	
	//借贷人协议（我要借款）
	.state('tab.jdxy', {
	  url: '/jdxy',
	  cache: false,
	  views: {
	    	'tab-addProduce': {
		    	templateUrl: 'templates/zjr/jdxy.html'
		    }
	  }
	})
	
	//借款人协议（我要借款）
	.state('tab.jkrxy', {
	  url: '/jkrxy',
	  cache: false,
	  views: {
	    	'tab-addProduce': {
		    	templateUrl: 'templates/zjr/jkrxy.html'
		    }
	  }
	 })
	
	//借贷协议-长贷短贷
/*	.state('tab.zjrjdxy', {
	  url: '/zjrjdxy',
	  cache: false,
	  views: {
	    	'tab-zjr': {
		    	templateUrl: 'templates/zjr/jdxy.html'
		    }
	  }
	})	*/
	
	//短贷笔数-中诚信
	.state('tab.creditLoanDuanDetail', {
	  url: '/creditLoanDuanDetail/:customerId',
	  cache: true,
	  views: {
	    'tab-credit': {
	      templateUrl: 'templates/common/loanList.html',
	      controller:'LoanDuanDetailCtrl'
	    }
	  }
	})
	
	//长贷笔数-中诚信
	.state('tab.creditLoanChangDetail', {
	  url: '/creditLoanChangDetail/:customerId',
	  cache: true,
	  views: {
	    'tab-credit': {
	      templateUrl: 'templates/common/changList.html',
	      controller:'LoanChangDetailCtrl'
	    }
	  }
	})
	
	//点击我要借款进行信息认证
	.state('tab.isAuthentication', {
	  url: '/isAuthentication',
	  cache: false,
	  views: {
	    	'tab-addProduce': {
		    	templateUrl: 'templates/zjr/isAuthentication.html',
		    	controller:'AuthenticationController'
		    }
	  }
	})
	
	//我要借款里面的实名绑卡界面
	.state('tab.authBandCard', {
      url: '/authBandCard',
      cache: false,
      views: {
        'tab-addProduce': {
        	controller:'BandCardCtrl',
        	templateUrl: 'templates/my/bandCard.html'
        }
      }
 	})
	
	//借款人协议-新手贷
	.state('tab.jkrxy-x', {
	  url: '/jkrxy-x',
	  cache: false,
	  views: {
	    	'tab-addProduce': {
		    	templateUrl: 'templates/zjr/jkrxy.html'
		    }
	  }
	})
	
	//出借人协议
	.state('tab.cjrxy', {
	  url: '/cjrxy',
	  cache: false,
	  views: {
	    	'tab-addProduce': {
		    	templateUrl: 'templates/zjr/cjrxy.html'
		    }
	  }
	})

	
	//借贷协议-长贷短贷
/*	.state('tab.jdxy', {
	  url: '/jdxy',
	  cache: false,
	  views: {
	    	'tab-addProduce': {
		    	templateUrl: 'templates/zjr/jdxy.html'
		    }
	  }
	})*/
	
	//借贷协议-新手贷
	.state('tab.jdxy-x', {
	  url: '/jdxy-x',
	  cache: false,
	  views: {
	    	'tab-addProduce': {
		    	templateUrl: 'templates/zjr/jdxy.html'
		    }
	  }
	})
	
	//授权书-长贷短贷
	.state('tab.sqs', {
	  url: '/sqs',
	  cache: false,
	  views: {
	    	'tab-addProduce': {
		    	templateUrl: 'templates/zjr/sqs.html'
		    }
	  }
	})
	
	//授权书-新手贷
	.state('tab.sqs-x', {
	  url: '/sqs-x',
	  cache: false,
	  views: {
	    	'tab-addProduce': {
		    	templateUrl: 'templates/zjr/sqs.html'
		    }
	  }
	})
	
	//借不到钱01
	.state('tab.addProduceTip', {
	  url: '/addProduceTip',
	  cache: false,
	  views: {
	    'tab-addProduce': {
	      templateUrl: 'templates/zjr/addProduceTip.html'
	    }
	  }
	})
	
	//借不到钱02
	.state('tab.addProduceTip02', {
	  url: '/addProduceTip02',
	  cache: false,
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/zjr/addProduceTipMy.html'
	    }
	  }
	})
		
	//借不到钱（我的）
	.state('tab.addProduceTip031', {
	  url: '/addProduceTip031',
	  cache: false,
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/zjr/addProduceTip03.html'
	    }
	  }
	})
	//等级特权（我的）
	.state('tab.addProduceTip041', {
	  url: '/addProduceTip041',
	  cache: false,
	  views: {
	    'tab-my': {
	      templateUrl: 'templates/zjr/addProduceTip04.html'
	    }
	  }
	})
	
	//借不到钱（我要借款）
	.state('tab.addProduceTip03', {
	  url: '/addProduceTip03',
	  cache: false,
	  views: {
	    'tab-addProduce': {
	      templateUrl: 'templates/zjr/addProduceTip03.html'
	    }
	  }
	})
	//等级特权（我要借款）
	.state('tab.addProduceTip04', {
	  url: '/addProduceTip04',
	  cache: false,
	  views: {
	    'tab-addProduce': {
	      templateUrl: 'templates/zjr/addProduceTip04.html'
	    }
	  }
	})
	
	//自金融-登录
	.state('login', {
	  url: '/login',
	  cache: false,
	  controller:'LoginCtrl',
	  templateUrl: 'templates/login.html'
	})
	
	//注册
	.state('reg', {
	  url: '/reg',
	  cache: false,
	  controller:'RegCtrl',
	  templateUrl: 'templates/reg.html'
	})
	
	//忘记密码
	.state('forget', {
	  url: '/forget',
	  cache: false,
	  controller:'ForgetCtrl',
	  templateUrl: 'templates/forget.html'
	})
	
	//设置新密码
	.state('newpassword', {
	  url: '/newpassword',
	  cache: false,
	  controller:'ForgetCtrl',
	  templateUrl: 'templates/newpassword.html'
	})
	
	//注册成功后页面跳转
	.state('regsuccess', {
	  url: '/regsuccess',
	  cache: false,
	  controller:'RegSuccessCtrl',
	  templateUrl: 'templates/regsuccess.html'
		
	})
	
	//注册成功后绑定银行卡，进行实名认证
//	.state('bandCard', {
//	  url: '/bandCard',
//	  cache: false,
//	  controller:'BandCardCtrl',
//	  templateUrl: 'templates/bandCard.html'
//		
//	})


	//默认进入自金融
  $urlRouterProvider.otherwise('/tab/zjr');

});
